import java.util.Objects;

//自定义学生类
class Student{

    //定义学号字段作为学生的唯一标识即key值
    public String stuN;
    public Student(String stuN){
        this.stuN=stuN;
    }

    //必须重写其继承最高父类即Object类的equals和hashCode方法从而可以进行正常的哈希映射
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return Objects.equals(stuN, student.stuN);
    }

    @Override
    public int hashCode() {
        return Objects.hash(stuN);
    }
}


public class Test {
    public static void main(String[] args) {
        Student student1=new Student("3023234301");
        Student student2=new Student("3023234301");
        HashBuckGenerics<Student,Double> hashBuckGenerics=new HashBuckGenerics<>();
        hashBuckGenerics.put(student1,99.99);
        hashBuckGenerics.put(student2,99.99);
        System.out.println(hashBuckGenerics.get(student1));
        System.out.println(hashBuckGenerics.get(student2));
    }
}
